<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>奔跑的大雄</title>
    
    <style>
        body {
            background: #ccc;
        }
        div {
            position: absolute;  /*  固定背景 */
            width: 200px;
            height: 100px;
            background: url(./mag/bear.png) no-repeat;  /*  no-repeat: 平铺 */
            /* 多个动画 用逗号分隔        steps(8): 8步完成    infinite: 无线循环   forwards: 中间停留*/
            animation: bear 0.9s steps(8) infinite, move 10s forwards;  
        }

        @keyframes bear {
            0% {
                background-position: 0 0;   /* 背景平移  */
            }
            100% {
                background-position: -1600px 0;
            }
        }
        @keyframes move {
            0% {
                left: 0;    
            }
            100% {
                left: 50%;
                transform: translateX(-40%);
            }
        }
    </style>
</head>

<body>
  <div></div>
</body>

</html>